-module(siv).
-export([prime/1]).

rang(Max, Max) ->
	[Max];
rang(Mix, Max)->
	[Mix|rang(Mix+1, Max)].

remove_multiple(N, [H|Rest]) when H rem N == 0 ->
	remove_multiple(N, Rest);
remove_multiple(N, [H|Rest]) ->
	[H | remove_multiple(N, Rest)];
remove_multiple(_, [])->
	[].

sleve([H|Rest])->
	[H | sleve(remove_multiple(H, Rest))];
sleve([])->
	[].


prime(Max)->
	sleve(rang(2, Max)).
%	List = rang(2, Max),
%	remove_multiple(2, List).
